package com.study.spmongodb.wwj.thread2.char08;

/**
 * @author study
 * @version 1.0
 * @date 2020/12/8 15:57
 */
public class SyncInvoker {

    public static void main(String[] args) throws InterruptedException {
        FutureSerivce futureSerivce = new FutureSerivce();

        Future<String> sumbit = futureSerivce.sumbit(() -> {
            Thread.sleep(10_000L);
            return "FINISH";
        });

        while (!sumbit.isDone()) {
            System.out.print("*");
            Thread.sleep(100);
        }
        System.out.println("\r结果: " + sumbit.get());
        String s = get();
        System.out.println(s);
    }

    private static String get() throws InterruptedException {
        Thread.sleep(10_000L);
        return "FINISH";
    }
}
